{include file="public/head"/}
<body>
<div class="x-body">
    <form class="layui-form" >
        <div class="layui-form-item">
            <div class="layui-form-item">
                <label for="parkingNo" class="layui-form-label">
                    <span class="x-red">*</span>所属停车场:
                </label>
                <div class="layui-input-inline" style="width: 240px;">
                    <select name="parkingNo" lay-verify="required">
                        <option value="">选择停车场</option>
                        {foreach $parkinglist as $parking}
                        <option value="{$parking.parkingNo}">{$parking.parkingName}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="pklot" class="layui-form-label">
                    <span class="x-red">*</span>车位号:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="pklot" name="pklot" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"  style="width: 240px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="plateNumber" class="layui-form-label">
                    <span class="x-red">*</span>车牌号码:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="plateNumber" name="plateNumber" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"  style="width: 240px;"
                    >
                </div>
            </div>
            <div class="layui-form-item">
                <label for="empName" class="layui-form-label">
                    <span class="x-red">*</span>姓名:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="empName" name="empName" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"  style="width: 240px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="empMobile" class="layui-form-label">
                    <span class="x-red">*</span>手机:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="empMobile" name="empMoblie" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"  style="width: 240px;">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="familyAddress" class="layui-form-label">
                    <span class="x-red">*</span>住址:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="familyAddress" name="familyAddress" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"  style="width: 240px;">
                </div>
            </div>
<!--            <div class="layui-form-item">-->
<!--                <label for="start" class="layui-form-label">-->
<!--                    <span class="x-red">*</span>开始时间:-->
<!--                </label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input class="layui-input" placeholder="开始日期" name="startTime" id="start" style="width: 240px;">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="layui-form-item">-->
<!--                <label for="end" class="layui-form-label">-->
<!--                    <span class="x-red">*</span>截止时间:-->
<!--                </label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input class="layui-input" placeholder="截止日期" name="endTime" id="end" style="width: 240px;">-->
<!--                </div>-->
<!--            </div>-->
            <div class="layui-form-item">
                <label for="remarks" class="layui-form-label">
                    备注:
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="remarks" name="remarks"
                           autocomplete="off" class="layui-input"  style="width: 240px;">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="add" lay-submit="" id="L_repass">
                    添加
                </button>
            </div>

        </div>
    </form>
</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
            ,format: 'yyyyMMdd'
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
            ,format: 'yyyyMMdd'
        });
    });
    layui.use(['form'], function() {
        $ = layui.jquery;
        var form = layui.form,layer = layui.layer;
        form.on('submit(add)', function(data){
            console.log("yangzl",data.field);


            $.ajax({
                type: 'post',
                url: "{:url('add')}",
                data: data.field,
                success: function(res){
                    if(res.code=='0'){
                        layer.alert("添加成功", {icon: 6},function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.parent.location.reload();
                        });
                    }else{
                        layer.msg(res.msg);
                    }
                }
            })
            return false;
        });
    })

</script>

</body>

</html>